﻿@model bool
@using LotteryVoteMVC.Models
@using LotteryVoteMVC.Resources
@using LotteryVoteMVC.Utility
@using (Html.BeginForm("Search", "Account", new { Id = ViewBag.User.UserId, shadow = Model }))
{
    <div id="searchBar">
        @if (ViewBag.IsShadow ?? false)
        { 
            <span class="button"><a onclick="addShadow(@ViewBag.User.UserId);">@(Resource.New + Resource.SubUser)<img src="@Url.Content("~/Content/Images/add.png")"></a></span>
        }
        else
        {
            if (ViewBag.Matrix.UserId == ViewBag.User.UserId || (ViewBag.User.ParentId == ViewBag.Matrix.UserId && ViewBag.User.Role == Role.Shadow))
            {
            <span class="button"><a onclick="addAccount(@ViewBag.User.UserId);">@(Resource.New + Resource.ResourceManager.GetString((ViewBag.Matrix.Role + 1).ToString()))<img src="@Url.Content("~/Content/Images/add.png")"></a></span>
            }
        }
        <span>@Resource.Name:</span>@Html.TextBox("Name")
        <span>@Resource.UserName:</span>@Html.TextBox("UserName")
        <span>@Resource.Status:</span>
        @Html.DropDownList("State", EnumHelper.ToSelectList<UserState>(
                it => it == UserState.Active,
                it => Resource.ResourceManager.GetString(it.ToString()),
                it => it.ToString()))
        <span>@Resource.Sort</span>
        <select id="SortField" name="SortField">
            <option value="@LotteryVoteMVC.Models.User.USERNAME">@Resource.UserName</option>
            <option value="@LotteryVoteMVC.Models.UserInfo.CREATETIME">@Resource.CreateTime</option>
            <option value="@LotteryVoteMVC.Models.UserInfo.STATE">@Resource.Status</option>
            <option value="LastLoginTime">@Resource.LastLoginTime</option>
        </select>
        <input type="submit" name="search" id="search" value="@Resource.Search" />
    </div>
}